package com.tedu.ivos.autit.controller;

import com.tedu.ivos.autit.pojo.dto.AuditQuery;
import com.tedu.ivos.autit.pojo.dto.AuditSaveFormParam;
import com.tedu.ivos.autit.pojo.vo.AuditVO;
import com.tedu.ivos.autit.service.IAuditService;
import com.tedu.ivos.base.response.JsonResult;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Slf4j
@RestController
@RequestMapping("/v1/audit")
public class AuditController {
    @Autowired
    IAuditService auditService;

    @GetMapping("select")
    public JsonResult select(AuditQuery auditQuery){
        log.debug("查询审批单：参数={}",auditQuery);
        List<AuditVO> list = auditService.select(auditQuery);
        log.debug(list.toString());
        return JsonResult.ok(list);
    }
    @PostMapping("update")
    public JsonResult update(AuditSaveFormParam auditSaveFormParam){
        log.debug("更新审批单：参数={}",auditSaveFormParam);
        auditService.update(auditSaveFormParam);
        return JsonResult.ok();
    }
}
